<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@page import="com.entity.User"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>Nhat Huy - Servlet and JSP Final Project</title>

<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="css/sb-admin.css" rel="stylesheet">

<!-- Morris Charts CSS -->
<link href="css/plugins/morris.css" rel="stylesheet">

<!-- Custom Fonts -->
<link href="font-awesome-4.1.0/css/font-awesome.min.css"
	rel="stylesheet" type="text/css">
</head>

<body>
	<div id="wrapper">
		<!-- Navigation -->
		<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
		<!-- Brand and toggle get grouped for better mobile display -->
		<div class="navbar-header">
			<a class="navbar-brand" href="index.jsp">Nhat Huy</a>
		</div>
		<!-- Top Menu Items -->
		<ul class="nav navbar-right top-nav">
            	<%if (session.getAttribute("userName")==null) {%>
	            	<li>
	                    <a href="LoginForm.jsp" class="dropdown-toggle">Login</a>
	                </li>
	                <li>
	                    <a href="RegisterForm.jsp" class="dropdown-toggle">Register</a>	                  
	                </li>
	            <%} else {%>
	            	<li>
	            		<a class="dropdown-toggle"><%=session.getAttribute("userName")%></a>	            		
	            	</li>
	            	<li>
	            		<a href="Logout" class="dropdown-toggle">Log Out</a>
	            	</li>
	            <%} %>
            </ul>
		<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
            <div class="collapse navbar-collapse navbar-ex1-collapse">
            	<ul class="nav navbar-nav side-nav">
            		<%if (session.getAttribute("userName")!=null) {%>
            			<li>
		                    <a href="ChangePasswordForm.jsp" class="dropdown-toggle">Change Password</a>
		                </li>
		            <%} else {%>
		                
	            	<%} %>
            	</ul>
            </div>
		<!-- /.navbar-collapse --> 
		</nav>
		<div id="page-wrapper">
			<div class="container-fluid">
				<!-- Page Heading -->
				<div class="row">
					<div class="col-lg-12">
						<h1 class="page-header">
							List Users <small>List all users in the database</small>
						</h1>
						<ol class="breadcrumb">
							<li class="active"><i class="fa fa-dashboard"></i>List Users</li>
						</ol>
					</div>
				</div>
				<!-- /.row -->
				<div>
					<a href="NewUser.jsp" class="btn btn-default">Add User</a><br>
					${changeMessage}
					<table>
						<tr>
							<td width="196"><label class="form-control">User Name</label></td>
							<td width="196"><label class="form-control">Password</label></td>
							<td width="196"><label class="form-control">Type</label></td>
							<td width="196"><label class="form-control">Registered Date</label></td>	
						</tr>
					</table>
					<c:forEach var="user" items="${userList}">
						<form action="DeleteUpdate" method="post">
							<table>
								<tr>
									<td><input type="text" name="txtUserName"
										class="form-control" value="${user.userName}"
										readonly="readonly"></input></td>
									<td><input type="text" name="txtPassword"
										class="form-control" value="${user.password}"></td>
									<td><input type="text" name="txtType" class="form-control"
										value="${user.type }"></td>
									<td><input type="text" name="txtRegisteredDate"
										class="form-control" value="${user.registeredDate }"></td>
									<td><input type="submit" value="Delete" name="btnChange"
										class="btn btn-default"></td>
									<td><input type="submit" value="Update" name="btnChange"
										class="btn btn-default"></td>
								</tr>
							</table>
						</form>
					</c:forEach>
				</div>
			</div>
			<!-- /.container-fluid -->
		</div>
		<!-- /#page-wrapper -->

	</div>
</body>
</html>